package it.koutifaris.travianmap.transformation;

public class Point2SquareTransformation implements XYTransformation {

	private double squareSize;

	public Point2SquareTransformation(double squareSize) {
		this.squareSize = squareSize;
	}

	public double getSquareSize() {
		return squareSize;
	}

	public void setSquareSize(double squareSize) {
		this.squareSize = squareSize;
	}

	@Override
	public double transformX(double pointX) {
		return transform(pointX);
	}

	@Override
	public double transformY(double pointY) {
		return transform(pointY);
	}

	protected int transform(double point) {
		return (int) Math.floor(point / getSquareSize());
	}

}
